package top.dingwen.io.treasure.encrypt.api.exception;

import lombok.Getter;
import top.dingwen.io.treasure.base.exception.ExceptionCode;
import top.dingwen.io.treasure.base.util.str.StringPlusUtils;
import top.dingwen.io.treasure.encrypt.api.constant.EncryptApiConstant;

/**
 * EncryptExceptionCode : 加解密异常码
 *
 * @author dingwen
 * @since 2024/11/7 16:05
 */
@Getter
public enum EncryptApiExceptionCode implements ExceptionCode {
    /**
     * 非法的访问
     */
    ILLEGAL_VISIT("ILLEGAL_VISIT", "非法的访问", EncryptApiConstant.EN_L_P_S, StringPlusUtils.EMPTY),

    /**
     * 加解密异常
     */
    API_ENCRYPT("API_ENCRYPT", "加解密异常", EncryptApiConstant.EN_L_P_S, StringPlusUtils.EMPTY);

    /**
     * 异常码
     */
    private final String exCode;

    /**
     * 消息
     */
    private String message;

    /**
     * 所属模块
     */
    private final String module;

    /**
     * 消息键
     */
    private final String key;


    /**
     * 通用异常码构造器
     *
     * @param exCode  异常码
     * @param message 消息
     * @param module  所属模块
     * @param key     消息键
     */
    EncryptApiExceptionCode(String exCode,
                            String message,
                            String module,
                            String key) {
        this.exCode = exCode;
        this.message = message;
        this.module = module;
        this.key = key;
    }

    @Override
    public void setMessage(String message) {
        this.message = message;
    }
}
